﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using KinectTD.UI;
namespace KinectTD.State_Management
{
    public class MenuScreen : Screen
    {

        private Header menuHeader;

        /// <summary>
        /// The header object used to describe the menu
        /// </summary>
        public Header MenuHeader
        {
            get { return menuHeader; }
            set { menuHeader = value; }
        }

        private List<Button> menuButtons;

        /// <summary>
        /// A list of buttons used to for the menu
        /// </summary>
        public List<Button> MenuButtons
        {
            get { return menuButtons; }
            set { menuButtons = value; }
        }

        public MenuScreen(Header header, List<Button> buttons, int width, int height)
            : base(width, height)
        {
            menuHeader = header;
            menuButtons = buttons;
        }

        public MenuScreen(List<Button> buttons, int width, int height)
            : base(width, height)
        {
            menuHeader = null;
            menuButtons = buttons;
        }

        public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
        {
            foreach (Button b in menuButtons)
            {
                b.Update(gameTime);
            }
        }

        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            if (backgroundImage != null)
                spriteBatch.Draw(backgroundImage, spriteBatch.GraphicsDevice.Viewport.Bounds, new Color(255, 255, 255, ScreenAlpha));
            if (menuHeader != null)
                menuHeader.Draw(spriteBatch);
            foreach (Button b in menuButtons)
                b.Draw(spriteBatch);


        }


        protected override void LoadContent(Microsoft.Xna.Framework.Content.ContentManager Content)
        {
            if (menuHeader != null)
                menuHeader.LoadContent(Content);
            foreach (Button b in menuButtons)
                b.LoadContent(Content);
        }
    }
}
